#include <wx/dialog.h>
#include <wx/wfstream.h>
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <future>
#include <fstream>
#include <regex>
#include "DataServer.h"

wxDEFINE_EVENT(IMPORT_UPDATA_EVT, wxCommandEvent);
wxDEFINE_EVENT(IMPORT_FINISH_EVT, wxCommandEvent);

class dealImportData
{
public:
	dealImportData(wxWindow* parent ,std::string Path);
	void operator() ();
	std::list<examItemData>* readItemList;
private:
	
	std::string Path;
	wxWindow* parent_;
	void dealData();
};

class ImportDataDialog : public wxDialog
{
public:
	ImportDataDialog(wxWindow* parent, std::string importPath,std::shared_ptr<DataServer> dataS_,std::string examName);
	~ImportDataDialog();
	virtual int ShowModalPlus();
private:
	std::list<examItemData> readItemList;
	std::shared_ptr<DataServer> dataS;
	wxStaticText* txtInf;
	dealImportData dealThread1;
	void onUpdata_data(wxCommandEvent& e);
	void onFinish_dealData(wxCommandEvent& e);
	std::future<void> dealDataThread;
	unsigned long counter;
	std::string ExamName;
	wxDECLARE_EVENT_TABLE();
};

